<?php
class gui{
	public $controller;
	public $url;
	public $path;
	public $menu;

	public function __construct($controller){
		$this->controller = $controller;
		$this->url = $controller->url;
		$this->path = $controller->path;
		$this->menu = null;
	}

	public function show(){
		$page = "view/".$this->url[0]."/".$this->url[0].".php";
		if(!file_exists($page)){
			$this->controller->redirect("error/404/".implode("/", $this->url));
		}

		$menu = $this->controller->createMenu();

		$link = $this->path."index.php?url=";
		$css = $this->path."public/css/";
		$img = $this->path."public/img/";
		$js = $this->path."public/js/";

		$show = false;
		if(isset($_SESSION["message"]) && !empty($_SESSION["message"])){
			$message = $_SESSION["message"];
			$show = true;
		}

		require("layout.php");

		unset($_SESSION["message"]);
	}
}
?>